
/*
 *  实现servlate
 * 1.创建普通Java类
 * 2.实现servlate规范，继承HttpServlet 类
 * 3.重写servlse 的方法，用来处理请求
 * 4.设置注解，指定访问路径
* */

import jakarta.servlet.ServletException;
import jakarta.servlet.annotation.WebServlet;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;

import java.io.IOException;

@WebServlet("/servlet01")
public class servlate01 extends HttpServlet {
    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        //打印类容
        System.out.println("点击事件");
        //通过输出流来输出到浏览器上面
        resp.getWriter().write("点击事件");
    }
}
